package net.wofly.common.util;

/**
 * Desc:
 * Created by LiuJianbo on 2017/10/23.
 */
public enum CommonStatus {

    无效(0, "无效","invalid"), 
    有效(1, "有效","valid");

    private Integer value;
    private String name;
    private String ename;

    private CommonStatus(Integer value, String name, String ename) {
        this.value = value;
        this.name = name;
        this.ename = ename;
    }

    public static boolean isValueCorrect(Integer value) {
        for (CommonStatus forEnum : values()) {
            if (value == forEnum.getValue().intValue()) {
                return true;
            }
        }
        return false;
    }

    public static String getName(Integer value) {
        if (value == null) {
            return null;
        }
        for (CommonStatus forEnum : values()) {
            if (value.equals(forEnum.getValue())) {
                return forEnum.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }
    
    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

}
